<?php
namespace app\restaurant\model;

use app\BaseModel;
use think\facade\Db;

class StoreConfig extends BaseModel
{
    //定义表名
    protected $name = 'longbing_card_restaurant_store_config';


    /**
     * @author chenniang
     * @DataTime: 2020-10-09 17:05
     * @功能说明:配置详情
     */
    public function configInfo($dis){

        $data = $this->where($dis)->find();

        if(empty($data)){

            $this->configAdd($dis);

            $data = $this->where($dis)->find();
        }

        return $data->toArray();

    }


    /**
     * @author chenniang
     * @DataTime: 2020-09-29 11:04
     * @功能说明:配置添加
     */
    public function configAdd($data){

        $res = $this->insert($data);


        return $res;

    }



    /**
     * @author chenniang
     * @DataTime: 2020-09-29 11:05
     * @功能说明:配置编辑
     */
    public function configUpdate($dis,$data){

        $res = $this->where($dis)->update($data);

        return $res;

    }













}